#include "CWorldBossData.h"
#include "MsgWorldBoss.pb.h"

/************************************************************************/
/*                    CWorldBossAtkUnit                                 */
/************************************************************************/
template<>
bool CRankArray<CWorldBossAtkUnit, CWorldBossMonster::WB_MONSTER_ATK_RANK_COUNT>::IsSame(CWorldBossAtkUnit& stA, CWorldBossAtkUnit& stB) const
{
    return (stA.GetGID() == stB.GetGID());
}

template<>
int CRankArray<CWorldBossAtkUnit, CWorldBossMonster::WB_MONSTER_ATK_RANK_COUNT>::CmpFunc(CWorldBossAtkUnit& stA, CWorldBossAtkUnit& stB) const
{
    if (stA.GetAtkValue() > stB.GetAtkValue())
    {
        return 1;
    }
    else if (stA.GetAtkValue() < stB.GetAtkValue())
    {
        return -1;
    }

    return 0;
}

void CWorldBossAtkUnit::GetAtkRankUnit(MsgWorldBossAtkRank& stAtkRankUnit)
{
    stAtkRankUnit.set_role_name(_sRoleName());
    stAtkRankUnit.set_attack_value(_iAtkValue);
    stAtkRankUnit.set_academy_type(_iAcademy);
}

/************************************************************************/
/*                    CWorldBossMonster                                 */
/************************************************************************/
int CWorldBossMonster::GetRankRoleOrder(unsigned int uiGID)
{
    for(int i = 0; i < GetRankSize(); ++i)
    {
        CWorldBossAtkUnit& stAtkRank = GetRankUnit(i);
        if (stAtkRank.GetGID() == uiGID)
        {
            return i;
        }
    }

    return -1;//协商返回-1
}




